﻿using System;

namespace NQueries
{
    /// <summary>
    /// Implements the UnitOfWork pattern.
    /// </summary>
    public interface IUnitOfWork : IDisposable
    {
        /// <summary>
        /// Returns the current <see cref="IDataContext"/>.
        /// </summary>
        IDataContext DataContext { get; }

        /// <summary>
        /// The name of the unit of work.
        /// </summary>
        string Name { get; }

        /// <summary>
        /// Saves the changes and commits the unit of work.
        /// </summary>
        /// <returns>The number of objects that have its state changed.</returns>
        int Commit();
    }
}